package com.mrd.gtimp.business.service;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.stereotype.Service;

import com.abc.trustpay.client.Base64;
import com.abc.trustpay.client.JSON;
import com.abc.trustpay.client.ebus.PaymentRequest;
import com.abc.trustpay.client.ebus.PaymentResult;
import com.abc.trustpay.client.ebus.QueryOrderRequest;
import com.mrd.framework.utils.SpringUtils;
import com.mrd.gtimp.base.entity.Company;
import com.mrd.gtimp.business.entity.FundAccount;
import com.mrd.gtimp.business.entity.FundFlow;
import com.mrd.gtimp.business.entity.PayResponseResolveLog;
import com.mrd.gtimp.business.repository.PayResponseResolveLogDao;
import com.mrd.gtimp.v2.fund.FundFinancialTypeEnum;
import com.mrd.gtimp.v2.fund.FundIETypeEnum;
import com.mrd.gtimp.v2.fund.FundStateEnum;

/**
 * 农业银行支付业务
 *
 * @author xiewl
 */
@Service
public class PaymentABCBiz1 implements PaymentABCBiz {

  private final Logger abcLogger = LoggerFactory.getLogger(PaymentABCBiz1.class);

  /**
   * 支付请求对象的固定参数 /* private final String RP_payTypeID = "ImmediatePay"; // 交易类型(直接支付) private final
   * String RP_currencyCode = "156"; // 交易币种(人民币) private final String RP_installmentMark = "0"; //
   * 分期标识（不分期) private final String RP_commodityType = "0101"; // 商品种类(暂定为‘实名类’) private final
   * String RP_productName = "传运通"; // 商品名称(暂定为‘传运通’) private final String RP_paymentType = "A"; //
   * 支付类型(支付方式合并) private final String RP_paymentLinkType = "1"; // 交易渠道(internet网络接入) private final
   * String RP_notifyType = "1"; // 通知方式(服务器通知) private final String RP_resultNotifyURL =
   * "http://www.56cyt.com/cyt/receiveABCPayResponse.html"; // 通知地址(待定) private final String
   * RP_isBreakAccount = "0"; // 交易是否分账(否)
   */
  /**
   * 参数配置清单
   */
  private Properties properties;
  /**
   * 请求对象
   */
  private String RP_payTypeID; // 交易类型(直接支付)
  private String RP_currencyCode; // 交易币种(人民币)
  private String RP_installmentMark; // 分期标识（
  // 不分期)
  private String RP_commodityType; // 商品种类(暂定为‘实名类’)
  private String RP_productName; // 商品名称(暂定为‘传运通’)
  private String RP_paymentType_A; // 支付类型(支付方式合并)
  private String RP_paymentType_COMP; // 支付类型(支付方式合并)
  private String RP_paymentLinkType; // 交易渠道(internet网络接入)
  private String RP_notifyType; // 通知方式(服务器通知)
  private String RP_resultNotifyURL; // 通知地址(待定)
  private String RP_isBreakAccount; // 交易是否分账(否)
  /**
   * 方法requestForPayment返回值的key定义
   */
  public final String KEY_paymentURL = "PaymentURL"; // 支付页面URL
  public final String KEY_request_result = "requestResult"; // 支付请求结果
  public final String KEY_request_result_success = "SUCCESS"; // 错误信息
  public final String KEY_request_result_failed = "FAILED"; // 错误信息
  public final String KEY_errorMessage = "errorMessage"; // 错误信息

  @Resource
  private CommonPaymentBiz commonPaymentBiz;
  @Resource
  private PayResponseResolveLogDao payResponseResolveLogDao;

  {// TODO: 2016/8/17
    try {
      properties = new Properties();
      properties.load(PaymentABCBiz.class.getResourceAsStream("/abcPayment.properties"));

      RP_payTypeID = properties.getProperty("RP_payTypeID");
      RP_currencyCode = properties.getProperty("RP_currencyCode");
      RP_installmentMark = properties.getProperty("RP_installmentMark");
      RP_commodityType = properties.getProperty("RP_commodityType");
      RP_productName = properties.getProperty("RP_productName");
      RP_paymentType_A = properties.getProperty("RP_paymentType_A");
      RP_paymentType_COMP = properties.getProperty("RP_paymentType_COMP");
      RP_paymentLinkType = properties.getProperty("RP_paymentLinkType");
      RP_notifyType = properties.getProperty("RP_notifyType");
      RP_resultNotifyURL = properties.getProperty("RP_resultNotifyURL");
      RP_isBreakAccount = properties.getProperty("RP_isBreakAccount");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  /**
   * 处理支付结果
   */

  public boolean receiveABCPayResponse(String mSG) {
    boolean isResult = false;
    // 创建回执解析记录，填入回执来源为支付平台；填入接收到的回执json字符串
    PayResponseResolveLog payResponseResolveLog =
        new PayResponseResolveLog(PayResponseResolveLog.ResponseFromEnum.PayPlatform, mSG);
    String orderNo = null;
    try {
      PaymentResult tResult = new PaymentResult(mSG);
      abcLogger.debug(mSG + ",收到银行通知");
      orderNo = tResult.getValue("OrderNo");
      JdbcTemplate jdbcTemplate = SpringUtils.getBean(JdbcTemplate.class);

      if (tResult.isSuccess()) { // 支付成功
        logAbcResponse(tResult); // 记录日志
        double amount = new Double(tResult.getValue("Amount"));
        String bankListId = tResult.getValue("iRspRef");
        String compId = null;
        try {
          // 获取公司ID,重复通知时抛出异常
          compId = commonPaymentBiz.getComIdByOrderNo(orderNo);
        } catch (Exception e) {
          abcLogger.info(orderNo + "被重复通知,直接返回");
          payResponseResolveLog
              .setStatus(PayResponseResolveLog.ResolveStatusEnum.Abandon.toString());

          return false;
        }
        // 资金到账，修改业务充值记录，新增流水记录
        commonPaymentBiz.arrivalAccount(compId, amount, orderNo, FundIETypeEnum.ONLINE_RECHARGE,
            bankListId);
        isResult = true;
      } else {
        // 修改业务记录
        jdbcTemplate.update("update T_BIZ_FUND_AJUSTMENT set state=? where bill_no=?",
            new Object[] {FundStateEnum.FAIL.toString(), orderNo});
        abcLogger.info("订单：" + orderNo + " 支付失败，原因为：" + tResult.getReturnCode()
            + tResult.getErrorMessage() + ";支付方式：农行");

      }
      payResponseResolveLogDao.save(payResponseResolveLog); // 保存日志
    } catch (Exception e) {
      // 异常信息保存到解析记录中，并在解析记录中标记“出现了异常”。
      abcLogger.error("处理[" + orderNo + "]的到账通知是出现异常：" + e.getMessage());
      payResponseResolveLog.setCatchException(true);
      payResponseResolveLog.setExceptionMsg(e.getMessage());
      payResponseResolveLogDao.save(payResponseResolveLog);
      e.printStackTrace();
    }
    return isResult;
  }

  /**
   * 请求交易test
   */
  public Map<String, String> requestForPayment(String orderNo, String orderAmount,
      String productName, String paymentType) {
    try {
      Map<String, String> forReturn = new HashMap<String, String>();

      PaymentRequest paymentRequest =
          conbimeOnePaymentRequestObject(orderNo, orderAmount, productName, paymentType);
      /* 验证支付请求对象封装是否成功 */
      if (paymentRequest == null) {
        forReturn.put(KEY_request_result, KEY_request_result_failed);
        forReturn.put(KEY_errorMessage, "支付请求失败!");
        abcLogger.error("支付请求对象封装失败错误");
        return forReturn;
      }

      //
      JSON paymentRequestResult = paymentRequest.postRequest();
      // 发送支付请求
      // JSON paymentRequestResult = null;

      String ReturnCode = paymentRequestResult.GetKeyValue("ReturnCode");
      String ErrorMessage = paymentRequestResult.GetKeyValue("ErrorMessage");
      if (ReturnCode.equals("0000")) {
        forReturn.put(KEY_request_result, KEY_request_result_success);
        forReturn.put(KEY_paymentURL, paymentRequestResult.GetKeyValue("PaymentURL"));
        abcLogger.error("支付请求成功.errorCode:" + ReturnCode + ",errorMessage:" + ErrorMessage);
      } else {
        forReturn.put(KEY_request_result, KEY_request_result_failed);
        forReturn.put(KEY_errorMessage, ReturnCode + " : " + ErrorMessage);
      }

      return forReturn;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }

  /**
   * 构造支付请求对象
   *
   * @param orderNo 订单编号
   * @param orderAmount 订单金额
   * @param productName 商品项目名称
   */
  private PaymentRequest conbimeOnePaymentRequestObject(String orderNo, String orderAmount,
      String productName, String paymentType) {
    try {
      do {
        /**
         * 生成数据
         */
        Date current = new Date();
        String orderDate = dateFormatter(current, "yyyy/MM/dd"); // 订单日期
        String orderTime = dateFormatter(current, "hh:mm:ss"); // 订单时间
        // paymentType = "A";
        return conbimeOnePaymentRequestObject(RP_payTypeID, orderDate, orderTime, RP_currencyCode,
            orderNo, orderAmount, RP_installmentMark, RP_commodityType, productName, paymentType,
            RP_paymentLinkType, RP_notifyType, RP_resultNotifyURL, RP_isBreakAccount, orderNo);
      } while (false);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return null;
  }

  /**
   * 时间格式化
   */
  private String dateFormatter(Date date, String parttern) {
    try {
      // SimpleDateFormat formatter = new
      // SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      SimpleDateFormat formatter = new SimpleDateFormat(parttern);
      String result = formatter.format(date);

      return result;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }

  /**
   * 构造支付请求对象 下面列出的参数都是支付请求必须填写的,其他字段可以根据需要另行扩充
   *
   * @param payTypeID 交易类型(直接支付:"ImmediatePay")
   * @param orderDate 订单日期(yyyy/MM/DD)
   * @param orderTime 订单时间(HH:MM:SS)
   * @param orderNo 订单编号
   * @param orderAmount 交易金额
   * @param installmentMark 分期标识(1：分期；0：不分期)
   * @param commodityType 商品种类(0202:传统类;0203:实名类...)
   * @param productName 商品名称
   * @param paymentType 支付类型(1:农行卡支付,5:基于第三方的跨行支付,6:银联跨行支付...)
   * @param paymentLinkType 交易渠道(1:internet网络接入,2:手机网络接入...)
   * @param notifyType 通知方式(0:URL页面通知,1:服务器通知)
   * @param resultNotifyURL 通知URL地址
   * @param isBreakAccount 交易是否分账(0:否,1:是)
   */
  private PaymentRequest conbimeOnePaymentRequestObject(String payTypeID, String orderDate,
      String orderTime, String currencyCode, String orderNo, String orderAmount,
      String installmentMark, String commodityType, String productName, String paymentType,
      String paymentLinkType, String notifyType, String resultNotifyURL, String isBreakAccount,
      String merchantRemarks) {
    // 1、生成订单对象
    PaymentRequest tPaymentRequest = new PaymentRequest();
    tPaymentRequest.dicOrder.put("PayTypeID", payTypeID); // 设定交易类型(直接支付)
    tPaymentRequest.dicOrder.put("OrderDate", orderDate); // 设定订单日期 （必要信息
    // -YYYY/MM/DD）
    tPaymentRequest.dicOrder.put("OrderTime", orderTime); // 设定订单时间 （必要信息
    // -HH:MM:SS）
    // tPaymentRequest.dicOrder.put("orderTimeoutDate",
    // request.getParameter("orderTimeoutDate")); //设定订单有效期
    tPaymentRequest.dicOrder.put("OrderNo", orderNo); // 设定订单编号 （必要信息）
    tPaymentRequest.dicOrder.put("CurrencyCode", currencyCode); // 设定交易币种
    tPaymentRequest.dicOrder.put("OrderAmount", orderAmount); // 设定交易金额
    // tPaymentRequest.dicOrder.put("Fee", request.getParameter("Fee"));
    // //设定手续费金额
    // tPaymentRequest.dicOrder.put("OrderDesc",
    // request.getParameter("OrderDesc")); //设定订单说明
    // tPaymentRequest.dicOrder.put("OrderURL",
    // request.getParameter("OrderURL")); //设定订单地址
    // tPaymentRequest.dicOrder.put("ReceiverAddress",
    // request.getParameter("ReceiverAddress")); //收货地址
    tPaymentRequest.dicOrder.put("InstallmentMark", installmentMark); // 分期标识
    /*
     * if (request.getParameter("InstallmentMark") == "1" && request.getParameter("PayTypeID") ==
     * "DividedPay") { tPaymentRequest.dicOrder.put("InstallmentCode",
     * request.getParameter("InstallmentCode")); //设定分期代码
     * tPaymentRequest.dicOrder.put("InstallmentNum", request.getParameter("InstallmentNum"));
     * //设定分期期数 }
     */
    tPaymentRequest.dicOrder.put("CommodityType", commodityType); // 设置商品种类
    // tPaymentRequest.dicOrder.put("BuyIP", request.getParameter("BuyIP"));
    // // IP
    // tPaymentRequest.dicOrder.put("ExpiredDate",request.getParameter("ExpiredDate"));
    // // 设定订单保存时间

    // 2、订单明细
    LinkedHashMap orderitem = new LinkedHashMap();
    /*
     * orderitem.put("SubMerName", "测试二级商户1"); // 设定二级商户名称 orderitem.put("SubMerId", "12345"); //
     * 设定二级商户代码 orderitem.put("SubMerMCC", "0000"); // 设定二级商户MCC码
     * orderitem.put("SubMerchantRemarks", "测试"); // 二级商户备注项 orderitem.put("ProductID",
     * "IP000001");// 商品代码，预留字段
     */
    orderitem.put("ProductName", productName);// 商品名称
    /*
     * orderitem.put("UnitPrice", "1.00");// 商品总价 orderitem.put("Qty", "1");// 商品数量
     * orderitem.put("ProductRemarks", "测试商品"); // 商品备注项 orderitem.put("ProductType", "充值类");// 商品类型
     * orderitem.put("ProductDiscount", "0.9");// 商品折扣 orderitem.put("ProductExpiredDate", "10");//
     * 商品有效期
     */
    tPaymentRequest.orderitems.put(1, orderitem);

    /*
     * orderitem = new LinkedHashMap(); orderitem.put("SubMerName", "测试二级商户1"); // 设定二级商户名称
     * orderitem.put("SubMerId", "12345"); // 设定二级商户代码 orderitem.put("SubMerMCC", "0000"); //
     * 设定二级商户MCC码 orderitem.put("SubMerchantRemarks", "测试"); // 二级商户备注项 orderitem.put("ProductID",
     * "IP000001");// 商品代码，预留字段 orderitem.put("ProductName", "中国联通IP卡");// 商品名称
     * orderitem.put("UnitPrice", "1.00");// 商品总价 orderitem.put("Qty", "2");// 商品数量
     * orderitem.put("ProductRemarks", "测试商品"); // 商品备注项 orderitem.put("ProductType", "充值类");// 商品类型
     * orderitem.put("ProductDiscount", "0.9");// 商品折扣 orderitem.put("ProductExpiredDate", "10");//
     * 商品有效期 tPaymentRequest.orderitems.put(2, orderitem);
     */

    // 3、生成支付请求对象
    tPaymentRequest.dicRequest.put("PaymentType", paymentType); // 设定支付类型
    tPaymentRequest.dicRequest.put("PaymentLinkType", paymentLinkType); // 设定支付接入方式
    /*
     * if (paymentType.equals(Constants.PAY_TYPE_UCBP) &&
     * paymentLinkType.equals(Constants.PAY_LINK_TYPE_MOBILE)) {
     * tPaymentRequest.dicRequest.put("UnionPayLinkType", request.getParameter("UnionPayLinkType"));
     * // 当支付类型为6，支付接入方式为2的条件满足时，需要设置银联跨行移动支付接入方式 }
     */
    // tPaymentRequest.dicRequest.put("ReceiveAccount",request.getParameter("ReceiveAccount"));
    // // 设定收款方账号
    // tPaymentRequest.dicRequest.put("ReceiveAccName",request.getParameter("ReceiveAccName"));
    // // 设定收款方户名
    tPaymentRequest.dicRequest.put("NotifyType", notifyType); // 设定通知方式
    tPaymentRequest.dicRequest.put("ResultNotifyURL", resultNotifyURL); // 设定通知URL地址
    tPaymentRequest.dicRequest.put("MerchantRemarks", merchantRemarks);
    // // 设定附言
    tPaymentRequest.dicRequest.put("IsBreakAccount", isBreakAccount); // 设定交易是否分账
    // tPaymentRequest.dicRequest.put("SplitAccTemplate",request.getParameter("SplitAccTemplate"));
    // // 分账模版编号
    return tPaymentRequest;
  }

  /**
   * @see com.mrd.gtimp.business.biz.PaymentABCBiz#queryABCPayStatus(String) 向银行系统轮询订单是否支付
   */
  @Deprecated
  public Boolean queryABCPayStatus(String pay_id) {
    QueryOrderRequest orderRequest = new QueryOrderRequest();
    orderRequest.queryRequest.put("PayTypeID", "ImmediatePay"); // 交易类型:直接支付
    orderRequest.queryRequest.put("OrderNo", pay_id);
    abcLogger.error(pay_id + "发起查询接口");
    orderRequest.queryRequest.put("QueryDetail", "1");// 0：状态查询 1：详细查询
    JSON queryResult = orderRequest.postRequest();
    String ReturnCode = queryResult.GetKeyValue("ReturnCode");
    abcLogger.error("返回信息:" + ReturnCode);
    if (ReturnCode != null && ReturnCode.equals("0000")) {// 请求成功
      String orderInfo = queryResult.GetKeyValue("Order");
      if (orderInfo.length() < 1) {// 没有账单结果
        abcLogger.error("订单id：" + pay_id + ",尚未支付。");
        return false;
      } else {
        Base64 tBase64 = new Base64();
        String orderDetail = new String(tBase64.decode(orderInfo));
        queryResult.setJsonString(orderDetail);
        if (queryResult.GetKeyValue("Status").equals("04")) {// 订单状态为04支付成功
          abcLogger.error("订单id：" + pay_id + ",支付成功。");
          abcLogger.error(orderDetail);
          return true;
        } else {
          abcLogger.error("订单id：" + pay_id + ",尚未支付。农行返回代码：" + ReturnCode + "-"
              + queryResult.GetKeyValue("Status"));
          return false;
        }
      }

    } else {// 请求失败
      abcLogger.error("订单id：" + pay_id + ",尚未支付。农行返回代码：" + ReturnCode + ":"
          + queryResult.GetKeyValue("ErrorMessage"));
      return false;
    }
  }

  /**
   * 根据预付款编号询问银行支付结果
   * 
   * @param pay_id
   * @return
   */
  @Transactional
  public void askPayResultFromBank(String pay_id) throws Exception {
    if (pay_id != null) {
      JdbcTemplate jdbcTemplate = SpringUtils.getBean(JdbcTemplate.class);
      // 根据orderno得到compId
      abcLogger.info(pay_id + "开始基本验证");
      StringBuilder sql = new StringBuilder(
          "select COM_ID,BILL_NO from T_BIZ_FUND_AJUSTMENT where BID=? and state!='SUCCESS'");
      Map<String, Object> rtn = jdbcTemplate.queryForMap(sql.toString(), new Object[] {pay_id});
      String compId = (String) rtn.get("COM_ID");
      String orderNo = (String) rtn.get("BILL_NO");
      if (compId == null || "".equals(compId)) {
        abcLogger.info(orderNo + "被重复通知,直接返回");
        return;
      }
      Map<String, String> isPay = queryPay4Bank(orderNo);// 银行返回的到账结果
      if (isPay != null) {
        double amount = new Double(isPay.get("orderAmount"));// 金额
        String iRspRef = isPay.get("iRspRef");// 银行流水
        // 修改账户
        FundAccount fa = new FundAccount();
        FundFlow ff = new FundFlow();
        Company cp = new Company();
        cp.setId(compId);
        ff.setOwner(cp);
        ff.setFinancialType(FundFinancialTypeEnum.IN.toString());
        ff.setAmount(amount);
        changeFundAccBala(ff, fa);
        // 插入流水记录
        String flowId = String.valueOf(UUID.randomUUID());
        // java.sql.Date lastUpdDate = new java.sql.Date(fa.getLastUpdDate().getTime());
        jdbcTemplate.update(
            "insert into t_biz_fund_flow(id,com_id,amount,ie_type,FINANCIAL_TYPE,BALANCE,REG_DATE,BILL_NO,BANK_lIST_ID,remark) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
            new PreparedStatementSetter() {
              public void setValues(PreparedStatement ps) throws SQLException {
                ps.setString(1, flowId);
                ps.setString(2, fa.getComId());
                ps.setDouble(3, amount);
                ps.setString(4, FundIETypeEnum.ONLINE_RECHARGE.toString());
                ps.setString(5, FundFinancialTypeEnum.IN.toString());
                ps.setDouble(6, fa.getBalance());
                ps.setTimestamp(7, new java.sql.Timestamp(fa.getLastUpdDate().getTime()));
                ps.setString(8, orderNo);
                ps.setString(9, iRspRef);
                ps.setString(10, "主动询问银行");
              }
            });
        // 修改业务记录
        jdbcTemplate.update(
            "update T_BIZ_FUND_AJUSTMENT set state=?,REVIEW_DATE=?,FUNDFLOW_ID=? where bill_no=?",
            new Object[] {FundStateEnum.SUCCESS.toString(), fa.getLastUpdDate(), flowId, orderNo});

      }
    }
  }

  @Override
  @Transactional
  public Boolean changeFundAccBala(FundFlow ff, FundAccount fa) throws Exception {
    return commonPaymentBiz.changeFundAccBala(ff, fa);
  }

  private Map<String, String> queryPay4Bank(String orderNo) {
    Map<String, String> rtnPay = null;
    QueryOrderRequest orderRequest = new QueryOrderRequest();
    orderRequest.queryRequest.put("PayTypeID", "ImmediatePay"); // 交易类型:直接支付
    orderRequest.queryRequest.put("OrderNo", orderNo);
    abcLogger.error(orderNo + "发起查询接口");
    orderRequest.queryRequest.put("QueryDetail", "1");// 0：状态查询 1：详细查询
    JSON queryResult = orderRequest.postRequest();
    String ReturnCode = queryResult.GetKeyValue("ReturnCode");
    abcLogger.error("返回信息:" + ReturnCode);
    if (ReturnCode != null && ReturnCode.equals("0000")) {// 请求成功
      String orderInfo = queryResult.GetKeyValue("Order");
      if (orderInfo.length() < 1) {// 没有账单结果
        abcLogger.error("订单id：" + orderNo + ",尚未支付。");

      } else {
        Base64 tBase64 = new Base64();
        String orderDetail = new String(tBase64.decode(orderInfo));
        queryResult.setJsonString(orderDetail);
        if (queryResult.GetKeyValue("Status").equals("04")) {// 订单状态为04支付成功
          abcLogger.error("订单id：" + orderNo + ",支付成功。");
          abcLogger.error(orderDetail);
          rtnPay = new HashMap<String, String>();
          rtnPay.put("orderNo", queryResult.GetKeyValue("OrderNo"));
          rtnPay.put("orderAmount", queryResult.GetKeyValue("OrderAmount"));
          rtnPay.put("iRspRef", queryResult.GetKeyValue("iRspRef"));
        } else {
          abcLogger.error("订单id：" + orderNo + ",尚未支付。农行返回代码：" + ReturnCode + "-"
              + queryResult.GetKeyValue("Status"));
        }
      }

    } else {// 请求失败
      abcLogger.error("订单id：" + orderNo + ",尚未支付。农行返回代码：" + ReturnCode + ":"
          + queryResult.GetKeyValue("ErrorMessage"));
    }
    return rtnPay;
  }

  /**
   *
   * @param tResult
   */
  private void logAbcResponse(PaymentResult tResult) {
    abcLogger.info("paymentInfo : 支付成功.\n支付返回信息\n\n");
    abcLogger.info("errorMesg : " + tResult.getErrorMessage());
    abcLogger.info("returnCode : " + tResult.getReturnCode());
    abcLogger.info("OrderNo : " + tResult.getValue("OrderNo"));
    double amount = new Double(tResult.getValue("Amount"));
    abcLogger.info("Amount : " + amount);
    abcLogger.info("BatchNo : " + tResult.getValue("BatchNo"));
    abcLogger.info("VoucherNo : " + tResult.getValue("VoucherNo"));
    abcLogger.info("HostDate : " + tResult.getValue("HostDate"));
    abcLogger.info("HostTime : " + tResult.getValue("HostTime"));
    abcLogger.info("MerchantRemarks : " + tResult.getValue("MerchantRemarks"));
    abcLogger.info("PayType : " + tResult.getValue("PayType"));
    abcLogger.info("NotifyType : " + tResult.getValue("NotifyType"));
    abcLogger.info("iRspRef : " + tResult.getValue("iRspRef"));
  }
}
